# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-service-identity
pkgver=23.1.0
_commit=be2f98443fe0ce1d8dcc7f373ea53561bd929837
pkgrel=1
pkgdesc="Service identity verification for pyOpenSSL"
arch=('any')
license=('MIT')
url="https://pypi.python.org/pypi/service_identity"
depends=('python-attrs' 'python-pyasn1-modules' 'python-pyasn1' 'python-cryptography')
makedepends=('git' 'python-build' 'python-installer' 'python-hatchling' 'python-hatch-fancy-pypi-readme'
             'python-hatch-vcs')
checkdepends=('python-pytest' 'python-idna')
optdepends=('python-idna: for Internationalized Domain Names support')
replaces=('python-service_identity')
source=("git+https://github.com/pyca/service-identity.git#commit=$_commit")
sha512sums=('SKIP')

build() {
  cd service-identity
  python -m build -nw
}

check() {
  cd service-identity
  python -m installer --destdir=tmp_install dist/*.whl
  PYTHONPATH="$PWD/tmp_install/usr/lib/python3.11/site-packages" pytest
}
 
package() {
  cd service-identity
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
